package com.example.demo.jucConcurrent.Semaphore详解;

import java.util.concurrent.Semaphore;

public class TestSemaphore2 {
    public static void main(String[] args) {
        int permitsNum  = 2;
       final Semaphore semaphore = new Semaphore(permitsNum);
        try {
            System.out.println("avialablePermit"+semaphore.availablePermits());
            semaphore.release();
            System.out.println("aviiablePermit"+semaphore.availablePermits());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
